//
//  ReadWriteDataClass.h
//  MartketNote
//
//  Created by Nguyen Minh Giang on 12/14/13.
//  Copyright (c) 2013 Nguyen Minh Giang. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import "ProductInfo.h"
#import "LanguageClass.h"


#define ENT_PRODUCTS @"Products"
#define ENT_SETTINGS @"Settings"

#define ATT_ID @"id"
#define ATT_PRODUCT @"product"
#define ATT_DETAIL @"detail"
#define ATT_STATUS @"isDone"
#define ATT_QUANTITY @"quantity"
#define ATT_UNIT @"unit"

#define ATT_LANGUAGE @"language" 


@interface ReadWriteDataClass : NSObject

+ (NSMutableArray *)getDataProducts;
+ (void)insertNewProduct:(ProductInfo *)info;
+ (void)updateProduct:(ProductInfo *)info;
+ (void)deleteProduct:(ProductInfo *)info;
+ (void)insertNewProductWithID:(int)idPro name:(NSString *)name quantity:(float)quantity unit:(NSString *)unit detail:(NSString *)detail status:(BOOL)status;
+ (void)updateProductWithID:(NSManagedObject *)product newName:(NSString *)newName newQuantity:(float)newQuantity newUnit:(NSString *)newUnit newDetail:(NSString *)newDetail newStatus:(BOOL)newStatus;
+ (void)deleteManagedObject:(NSManagedObject *)managedObject;
+ (void)updateStatusProduct:(NSManagedObject *)product;
+ (int)getProductID;
+ (void)deleteAllData;

+ (int)getLanguage;
+ (void)insertNewSettingsWithLanguage:(int)language;
+ (void)updateLanguageWithNewLanguage:(int)newLanguage;

@end
